﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net.Mail;
using System.Net;

namespace OpenPhotoAlbum.BusinessLogics.Email
{
    public class EmailDefaultSmtpClientBuilder:IEmailSmtpClientBuilder
    {
        #region IEmailSmtpClientBuilder Members

        public System.Net.Mail.SmtpClient BuildSmtpClient()
        {
            SmtpClient client = new SmtpClient();
            client.Host = EmailConfigReader.Instance.ReadSmtpServerAddress();
            client.Port = EmailConfigReader.Instance.ReadSmtpServerPort();
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.EnableSsl = EmailConfigReader.Instance.ReadEnableSsl();
            client.Credentials = new NetworkCredential(
                EmailConfigReader.Instance.ReadUserName(),
                EmailConfigReader.Instance.ReadPassword());
            return client;
        }

        #endregion
    }
}
